<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span>  * $Id: om-tree.js,v 1.114 2012/06/20 02:29:10 wangfan Exp $
<span class='line'>  3</span>  * operamasks-ui omTree @VERSION
<span class='line'>  4</span>  *
<span class='line'>  5</span>  * Copyright 2011, AUTHORS.txt (http://ui.operamasks.org/about)
<span class='line'>  6</span>  * Dual licensed under the MIT or LGPL Version 2 licenses.
<span class='line'>  7</span>  * http://ui.operamasks.org/license
<span class='line'>  8</span>  *
<span class='line'>  9</span>  * http://ui.operamasks.org/docs/
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * Depends:
<span class='line'> 12</span>  *  om-core.js
<span class='line'> 13</span>  */</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="COMM">/**
<span class='line'> 15</span>      * @name omTree
<span class='line'> 16</span>      * @class 树型组件&lt;br/>&lt;br/>
<span class='line'> 17</span>      * treenode 支持两种json格式。&lt;br/>
<span class='line'> 18</span>      * 第一种为：&lt;br/>
<span class='line'> 19</span>      * &lt;pre>
<span class='line'> 20</span>      * {
<span class='line'> 21</span>      *     text:'node1', // 树节点显示文本，必需
<span class='line'> 22</span>      *     expanded:true, // 是否默认展开，非必须，默认值是false
<span class='line'> 23</span>      *     classes:'folder', // 树节点样式，非必需，默认有folder和file，如果用户自定制为其他，则显示用户自定义样式
<span class='line'> 24</span>      *     children:childrenDataArray, //子节点，非必需。缓加载时可以没有这个属性 
<span class='line'> 25</span>      *     hasChildren: false // 是否有子节点，非必需，如果值为true表示要缓加载此时可以没有children属性
<span class='line'> 26</span>      * } 
<span class='line'> 27</span>      * &lt;/pre>
<span class='line'> 28</span>      * 第二种为：&lt;br/>
<span class='line'> 29</span>      * &lt;pre>
<span class='line'> 30</span>      * {
<span class='line'> 31</span>      *     id:'n1', //树节点的标识，必需
<span class='line'> 32</span>      *     pid: 'n0' //父节点id，非必需，如果没有设置该节点就为根节点
<span class='line'> 33</span>      *     text:'node1', // 树节点显示文本，必需
<span class='line'> 34</span>      *     expanded:true, // 是否默认展开，非必须，默认值是false
<span class='line'> 35</span>      *     classes:'folder' // 树节点样式，非必需，默认有folder和file，如果用户自定制为其他，则显示用户自定义样式
<span class='line'> 36</span>      * } 
<span class='line'> 37</span>      * &lt;/pre>
<span class='line'> 38</span>      * 注意：如果使用第二中json格式，需要将simpleDataModel属性值设置为true。
<span class='line'> 39</span>      * omTree为每个节点自动生成的唯一标识nid，生成规则为treeId+ "_" + 计数，请用户在omTree的页面上避免
<span class='line'> 40</span>      * 使用此种规则定义其他对象的nid。不需要用户进行初始化，属于内部参数。
<span class='line'> 41</span>      * &lt;br/>
<span class='line'> 42</span>      * &lt;b>特点：&lt;/b>&lt;br/>
<span class='line'> 43</span>      * &lt;ol>
<span class='line'> 44</span>      *      &lt;li>可以使用本地数据源，也可以使用远程数据源&lt;/li>
<span class='line'> 45</span>      *      &lt;li>支持数据的缓加载（开始取数时不取子节点数据，第一次展开时才开始向后台取数）&lt;/li>
<span class='line'> 46</span>      *      &lt;li>提供丰富的事件&lt;/li>
<span class='line'> 47</span>      * &lt;/ol>
<span class='line'> 48</span>      * 
<span class='line'> 49</span>      * &lt;b>示例：&lt;/b>&lt;br/>
<span class='line'> 50</span>      * &lt;pre>
<span class='line'> 51</span>      * &lt;script type="text/javascript" >
<span class='line'> 52</span>      * var data = 
<span class='line'> 53</span>      *       [{
<span class='line'> 54</span>      *           "text": "1. Review of existing structures",
<span class='line'> 55</span>      *           "children":[{
<span class='line'> 56</span>      *               "text": "1.1 jQuery core"
<span class='line'> 57</span>      *           }]
<span class='line'> 58</span>      *       }, {
<span class='line'> 59</span>      *           "text": "2. Wrapper plugins",
<span class='line'> 60</span>      *           "expanded": true,
<span class='line'> 61</span>      *           "children":[{
<span class='line'> 62</span>      *               "text":"2.1 wrapper tips",
<span class='line'> 63</span>      *               "expanded": true,
<span class='line'> 64</span>      *               "children": [{
<span class='line'> 65</span>      *                   "text":"2.1.1 wrapper loader tips"
<span class='line'> 66</span>      *               },{
<span class='line'> 67</span>      *                   "text":"2.1.2 wrapper runder tips"
<span class='line'> 68</span>      *               }]
<span class='line'> 69</span>      *           },{
<span class='line'> 70</span>      *               "text":"2.2 tree nodes"
<span class='line'> 71</span>      *           }]
<span class='line'> 72</span>      *       }, {
<span class='line'> 73</span>      *           "text": "3. Summary"
<span class='line'> 74</span>      *       }, {
<span class='line'> 75</span>      *           "text": "4. Questions and answers"
<span class='line'> 76</span>      *       }];
<span class='line'> 77</span>      *   $(document).ready(function(){
<span class='line'> 78</span>      *       $("#mytree").omTree({
<span class='line'> 79</span>      *           dataSource : data
<span class='line'> 80</span>      *       });
<span class='line'> 81</span>      *   });
<span class='line'> 82</span>      * &lt;/script>
<span class='line'> 83</span>      * 
<span class='line'> 84</span>      * &lt;ul id="mytree"/>
<span class='line'> 85</span>      * &lt;/pre>
<span class='line'> 86</span>      * 
<span class='line'> 87</span>      * @constructor
<span class='line'> 88</span>      * @description 构造函数. 
<span class='line'> 89</span>      * @param options 标准options对象：{}
<span class='line'> 90</span>      */</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="PUNC">;</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 93</span>      * treenode: { text:'node1', expanded:true}
<span class='line'> 94</span>      */</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">CLASSES</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">  </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">            </span><span class="NAME">open</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"open"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">            </span><span class="NAME">closed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"closed"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">            </span><span class="NAME">expandable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"expandable"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">            </span><span class="NAME">expandableHitarea</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"expandable-hitarea"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">            </span><span class="NAME">lastExpandableHitarea</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"lastExpandable-hitarea"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">            </span><span class="NAME">collapsable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"collapsable"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">            </span><span class="NAME">collapsableHitarea</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"collapsable-hitarea"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">            </span><span class="NAME">lastCollapsableHitarea</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"lastCollapsable-hitarea"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">            </span><span class="NAME">lastCollapsable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"lastCollapsable"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">            </span><span class="NAME">lastExpandable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"lastExpandable"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">            </span><span class="NAME">last</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"last"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">            </span><span class="NAME">hitarea</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"hitarea"</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">    </span><span class="NAME">$.omWidget</span><span class="PUNC">(</span><span class="STRN">"om.omTree"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">        </span><span class="NAME">_swapClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">c1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">c2</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">c1Elements</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.filter</span><span class="PUNC">(</span><span class="STRN">'.'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">c1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">            </span><span class="NAME">target.filter</span><span class="PUNC">(</span><span class="STRN">'.'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">c2</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="NAME">c2</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">c1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">            </span><span class="NAME">c1Elements.removeClass</span><span class="PUNC">(</span><span class="NAME">c1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">c2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>119</span>          * target: treenode LI DOM 
<span class='line'>120</span>          */</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">        </span><span class="NAME">_getParentNode</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$pnode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$pnode</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$pnode.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-tree-node"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$pnode</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">        </span><span class="NAME">_setParentCheckbox</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pnode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getParentNode</span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pnode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">checkbox</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pnode.find</span><span class="PUNC">(</span><span class="STRN">">ul >li >div.tree-checkbox"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">allChild</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">checkbox.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">full_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">checkbox.filter</span><span class="PUNC">(</span><span class="STRN">".checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">part_len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">checkbox.filter</span><span class="PUNC">(</span><span class="STRN">".checkbox_part"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pnode_checkbox</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pnode.find</span><span class="PUNC">(</span><span class="STRN">">div.tree-checkbox"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">                </span><span class="NAME">pnode_checkbox.removeClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_full checkbox_part"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">full_len</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">allChild</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">                    </span><span class="NAME">pnode_checkbox.addClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">full_len</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">part_len</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">                    </span><span class="NAME">pnode_checkbox.addClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_part"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">                </span><span class="NAME">this._setParentCheckbox</span><span class="PUNC">(</span><span class="NAME">pnode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">        </span><span class="NAME">_setChildCheckbox</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">checked</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">childck</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">node.find</span><span class="PUNC">(</span><span class="STRN">">ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'.tree-checkbox'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">            </span><span class="NAME">childck.removeClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_part checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">                </span><span class="NAME">childck.addClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">        </span><span class="COMM">// target equal the li elements</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">        </span><span class="NAME">_applyEvents</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">                </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">                </span><span class="NAME">onClick</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onClick</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">                </span><span class="NAME">onDblClick</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onDblClick</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">                </span><span class="NAME">onRightClick</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onRightClick</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>164</span> </span><span class="WHIT">                </span><span class="NAME">onDrag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="NAME">options.onDrag</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">                </span><span class="NAME">onSelect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onSelect</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">                </span><span class="NAME">onDrop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onDrop</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">            </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="STRN">"span"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"click"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">            	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">           	    </span><span class="NAME">onClick</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onClick"</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">                </span><span class="NAME">self.select</span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"dblclick"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">            	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nDom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>174</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">nDom.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nDom.hasClass</span><span class="PUNC">(</span><span class="STRN">"hasChildren"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT">                	</span><span class="NAME">nDom.find</span><span class="PUNC">(</span><span class="STRN">"span.folder"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT">            		</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"folder"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"placeholder"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">nDom.has</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">e.target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">                    </span><span class="NAME">self.toggler</span><span class="PUNC">(</span><span class="NAME">nDom</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">                </span><span class="NAME">nDom.find</span><span class="PUNC">(</span><span class="STRN">"span.placeholder"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"placeholder"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"folder"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">                </span><span class="NAME">onDblClick</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onDblClick"</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"contextmenu"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT">                     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>185</span> </span><span class="WHIT">                     </span><span class="NAME">onRightClick</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onRightClick"</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"mouseover mouseout"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT">                      </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e.type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"mouseover"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT">                          </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span> </span><span class="WHIT">                      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT">                      </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e.type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"mouseout"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT">                          </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT">                      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT">                      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>195</span> </span><span class="WHIT">            </span><span class="NAME">self._bindHitEvent</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">			 </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="STRN">"div.tree-checkbox"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">click</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodedata</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">node.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">                </span><span class="NAME">self._toggleCheck</span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self.isCheck</span><span class="PUNC">(</span><span class="NAME">nodedata</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.options.draggable</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">                </span><span class="NAME">target.omDraggable</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">                    </span><span class="NAME">revert</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"invalid"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT">                    </span><span class="NAME">onStart</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">ui</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT">                    	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">ui.helper.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT">                        </span><span class="NAME">onDrag</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onDrag"</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">                </span><span class="NAME">target</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT">                </span><span class="PUNC">.</span><span class="NAME">omDroppable</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">                	</span><span class="NAME">greedy</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">                    </span><span class="NAME">accept</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"li.om-tree-node"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT">                    </span><span class="NAME">onDragOver</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">                    	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.filter</span><span class="PUNC">(</span><span class="STRN">".treenode-droppable"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">                    	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nodes.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">                    		</span><span class="NAME">nodes.removeClass</span><span class="PUNC">(</span><span class="STRN">"treenode-droppable"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">                    	</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">                    		</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"treenode-droppable"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">                    	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">                    </span><span class="NAME">onDragOut</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">                    	</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"treenode-droppable"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">                    </span><span class="NAME">onDrop</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pnode</span><span class="PUNC">,</span><span class="NAME">bnode</span><span class="PUNC">,</span><span class="NAME">$item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$drop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$list</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$drop.find</span><span class="PUNC">(</span><span class="STRN">">ul"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">                        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"treenode-droppable"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT">                        </span><span class="NAME">$item.css</span><span class="PUNC">(</span><span class="STRN">"left"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">                        </span><span class="NAME">$item.css</span><span class="PUNC">(</span><span class="STRN">"top"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">drop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">$drop.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">dragnode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">$item.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$drop.has</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT">                           </span><span class="NAME">pnode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">drop</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT">                           </span><span class="NAME">bnode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">drop</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">                           </span><span class="NAME">dragnode.pid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">drop.pid</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">$item.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">                        </span><span class="NAME">self.remove</span><span class="PUNC">(</span><span class="NAME">dragnode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">                        </span><span class="NAME">self.insert</span><span class="PUNC">(</span><span class="NAME">dragnode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pnode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bnode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT">                        </span><span class="NAME">onDrop</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onDrop"</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT">            </span><span class="NAME">target.bind</span><span class="PUNC">(</span><span class="STRN">"mousedown"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT">                </span><span class="NAME">e.stopPropagation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">                </span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">        </span><span class="NAME">_bindHitEvent</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT">        	</span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="STRN">"div.hitarea"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">click</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">node.hasClass</span><span class="PUNC">(</span><span class="STRN">"hasChildren"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">            		</span><span class="NAME">node.find</span><span class="PUNC">(</span><span class="STRN">"span.folder"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">            		</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"folder"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"placeholder"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>258</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT">                </span><span class="NAME">self.toggler</span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT">                </span><span class="NAME">node.find</span><span class="PUNC">(</span><span class="STRN">"span.placeholder"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"placeholder"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"folder"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">        </span><span class="NAME">options</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">/** @lends omTree#*/</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">            </span><span class="COMM">/* 暂不支持
<span class='line'>265</span>              * 树初始状态时展开的层级.
<span class='line'>266</span>              * @type Number
<span class='line'>267</span>              * @default 0
<span class='line'>268</span>              * @example
<span class='line'>269</span>              * $("#mytree").omTree({initExpandLevel:2});
<span class='line'>270</span>              */</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">            </span><span class="NAME">initExpandLevel</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>273</span>              * 数据源属性，可以设置为后台获取数据的URL，比如dataSource : 'treedata.json'
<span class='line'>274</span>              * 也可以设置为静态数据，数据必须为JSON格式数组，比如dataSource : [{"text":"iPhone"},{"text":"iPad"}]；
<span class='line'>275</span>              * 其中支持两种JSON格式，第一种为
<span class='line'>276</span>              * &lt;pre>
<span class='line'>277</span>              * {
<span class='line'>278</span>              *     text: 'node1', // 树节点显示文本，必需
<span class='line'>279</span>              *     expanded: true, // 是否默认展开
<span class='line'>280</span>              *     classes: 'folder', // 树节点样式，非必需，默认有folder和file，用户可自定制此样式
<span class='line'>281</span>              *     hasChildren: false // 树节点懒加载的情况下，该节点在展开时自动向后台取数
<span class='line'>282</span>              * }
<span class='line'>283</span>              * &lt;/pre>
<span class='line'>284</span>              * 第二种为：
<span class='line'>285</span>              * &lt;pre>
<span class='line'>286</span>              * {
<span class='line'>287</span>              *     id:'n1', //树节点的标识，必需
<span class='line'>288</span>              *     pid: 'n0' //父节点id，非必需，如果没有设置该节点就为根节点
<span class='line'>289</span>              *     text: 'node1', // 树节点显示文本，必需
<span class='line'>290</span>              *     expanded: true, // 是否默认展开
<span class='line'>291</span>              *     classes: 'folder' // 树节点样式，非必需，默认有folder和file，用户可自定制此样式
<span class='line'>292</span>              * }
<span class='line'>293</span>              * &lt;/pre>
<span class='line'>294</span>              *  注意：如果使用第二中json格式，需要将simpleDataModel属性值设置为true。
<span class='line'>295</span>              * @name omTree#dataSource
<span class='line'>296</span>              * @type String,Array[JSON]
<span class='line'>297</span>              * @default 无
<span class='line'>298</span>              * @example
<span class='line'>299</span>              * dataSource : 'treedata.json'
<span class='line'>300</span>              * 或者
<span class='line'>301</span>              * dataSource : [{"text":"iPhone"},{"text":"iPad"}]
<span class='line'>302</span>              */</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">            </span><span class="COMM">/* 暂不支持
<span class='line'>304</span>              * 鼠标划过某个节点时是否高亮。
<span class='line'>305</span>              * @type Boolean
<span class='line'>306</span>              * @default false
<span class='line'>307</span>              * @example
<span class='line'>308</span>              * $("#mytree").omTree({lineHover:false});
<span class='line'>309</span>              */</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">            </span><span class="NAME">lineHover</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>312</span>              * 树节点是否显示图标。
<span class='line'>313</span>              * @type Boolean
<span class='line'>314</span>              * @default true
<span class='line'>315</span>              * @example
<span class='line'>316</span>              * $("#mytree").omTree({showIcon:false});
<span class='line'>317</span>              */</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">            </span><span class="NAME">showIcon</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT">            </span><span class="COMM">/* 暂不支持
<span class='line'>320</span>              * 树节点之间是否显示连线。
<span class='line'>321</span>              * @type Boolean
<span class='line'>322</span>              * @default true
<span class='line'>323</span>              * @example
<span class='line'>324</span>              * $("#mytree").omTree({showLine:true});
<span class='line'>325</span>              */</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">            </span><span class="NAME">showLine</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>328</span>              * 是否显示checkbox。
<span class='line'>329</span>              * @type Boolean
<span class='line'>330</span>              * @default false
<span class='line'>331</span>              * @example
<span class='line'>332</span>              * $("#mytree").omTree({showCheckbox:false});
<span class='line'>333</span>              */</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">            </span><span class="NAME">showCheckbox</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>336</span>              * 是否级联选中，该属性在showCheckbox为true的时候生效。
<span class='line'>337</span>              * @type Boolean
<span class='line'>338</span>              * @default true
<span class='line'>339</span>              * @example
<span class='line'>340</span>              * $("#mytree").omTree({cascadeCheck:true});
<span class='line'>341</span>              */</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT">            </span><span class="NAME">cascadeCheck</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>344</span>              * 树节点是否可拖拽。
<span class='line'>345</span>              * @type Boolean
<span class='line'>346</span>              * @default false
<span class='line'>347</span>              * @example
<span class='line'>348</span>              * $("#mytree").omTree({draggable:true});
<span class='line'>349</span>              */</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">            </span><span class="NAME">draggable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">            </span><span class="COMM">/*
<span class='line'>352</span>              * 暂不支持，通过方法过滤树节点，该方法会被每个树节点调用，当返回为false，该节点会被过滤掉。
<span class='line'>353</span>              * @type function
<span class='line'>354</span>              * @default null
<span class='line'>355</span>              * @example
<span class='line'>356</span>              * 将叶子节点过滤掉
<span class='line'>357</span>              * fucntion fn(node){
<span class='line'>358</span>              *   if(node.children){
<span class='line'>359</span>              *      return true;
<span class='line'>360</span>              *   }
<span class='line'>361</span>              *   retrun false;
<span class='line'>362</span>              * } 
<span class='line'>363</span>              * $("#mytree").omTree({filter:fn});
<span class='line'>364</span>              */</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT">            </span><span class="NAME">filter</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>366</span> </span><span class="WHIT">            </span><span class="COMM">// before refresh the node ,you can change the node</span><span class="WHIT">
<span class='line'>367</span> </span><span class="WHIT">            </span><span class="COMM">// nodeFomatter:null,</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">            </span><span class="NAME">nodeCount</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>369</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>370</span>              * 数据源是否为简单数据模型。
<span class='line'>371</span>              * @type Boolean
<span class='line'>372</span>              * @default false
<span class='line'>373</span>              * @example
<span class='line'>374</span>              * $("#mytree").omTree({simpleDataModel:true});
<span class='line'>375</span>              */</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">            </span><span class="NAME">simpleDataModel</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT">        </span><span class="NAME">_create</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">            </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>381</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-tree om-widget"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>382</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>383</span> </span><span class="WHIT">       </span><span class="WHIT">
<span class='line'>384</span> </span><span class="WHIT">        </span><span class="NAME">updateNode</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>385</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>386</span> </span><span class="WHIT">            </span><span class="COMM">// prepare branches and find all tree items with child lists</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">branches</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>388</span> </span><span class="WHIT">            </span><span class="COMM">//.prepareBranches(options);</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>390</span> </span><span class="WHIT">            </span><span class="COMM">//self._applyClasses(branches);</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">            </span><span class="NAME">self._applyEvents</span><span class="PUNC">(</span><span class="NAME">branches</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.control</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">                </span><span class="NAME">self._treeController</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options.control</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>396</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>397</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>398</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>399</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>400</span> </span><span class="WHIT">        </span><span class="COMM">// handle toggle event</span><span class="WHIT">
<span class='line'>401</span> </span><span class="WHIT">        </span><span class="COMM">// change the target to the treenode (li dom)</span><span class="WHIT">
<span class='line'>402</span> </span><span class="WHIT">        </span><span class="NAME">toggler</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>403</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>404</span> </span><span class="WHIT">                </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>405</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>406</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">nid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hidden</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.hasClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.expandable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>408</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>409</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">hidden</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>410</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">onBeforeExpand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onBeforeExpand</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>411</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">onBeforeExpand</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeExpand"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">onBeforeCollapse</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onBeforeCollapse</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">onBeforeCollapse</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeCollapse"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">            </span><span class="COMM">// swap classes for hitarea</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hitarea</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="STRN">">.hitarea"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">            </span><span class="NAME">self._swapClass</span><span class="PUNC">(</span><span class="NAME">hitarea</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.collapsableHitarea</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.expandableHitarea</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>424</span> </span><span class="WHIT">            </span><span class="NAME">self._swapClass</span><span class="PUNC">(</span><span class="NAME">hitarea</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastCollapsableHitarea</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastExpandableHitarea</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>425</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>426</span> </span><span class="WHIT">            </span><span class="COMM">// swap classes for li</span><span class="WHIT">
<span class='line'>427</span> </span><span class="WHIT">            </span><span class="NAME">self._swapClass</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.expandable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>428</span> </span><span class="WHIT">            </span><span class="NAME">self._swapClass</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>429</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>430</span> </span><span class="WHIT">            </span><span class="COMM">// find child lists</span><span class="WHIT">
<span class='line'>431</span> </span><span class="WHIT">            </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">">ul"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>432</span> </span><span class="WHIT">                </span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>433</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">hidden</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>434</span> </span><span class="WHIT">                        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>435</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">onExpand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onExpand</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>436</span> </span><span class="WHIT">                        </span><span class="NAME">onExpand</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onExpand"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>437</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>438</span> </span><span class="WHIT">                        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>439</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">onCollapse</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onCollapse</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>440</span> </span><span class="WHIT">                        </span><span class="NAME">onCollapse</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onCollapse"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>441</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>442</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>443</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>444</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>445</span> </span><span class="WHIT">        </span><span class="NAME">_init</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>446</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>447</span> </span><span class="WHIT">                </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>448</span> </span><span class="WHIT">                </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.dataSource</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>449</span> </span><span class="WHIT">            </span><span class="NAME">target.empty</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>450</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>451</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>452</span> </span><span class="WHIT">                    </span><span class="NAME">self._ajaxLoad</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>453</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>454</span> </span><span class="WHIT">                	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.simpleDataModel</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>455</span> </span><span class="WHIT">                		</span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._transformToNodes</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>456</span> </span><span class="WHIT">                	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>457</span> </span><span class="WHIT">                	</span><span class="NAME">target.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>458</span> </span><span class="WHIT">                    </span><span class="NAME">self._appendNodes.apply</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>459</span> </span><span class="WHIT">                    </span><span class="NAME">self.updateNode</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>460</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>461</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>462</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>463</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>464</span> </span><span class="WHIT">        </span><span class="NAME">_ajaxLoad</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>465</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>466</span> </span><span class="WHIT">                </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>467</span> </span><span class="WHIT">                </span><span class="NAME">onBeforeLoad</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onBeforeLoad</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>468</span> </span><span class="WHIT">                </span><span class="NAME">onSuccess</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onSuccess</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>469</span> </span><span class="WHIT">                </span><span class="NAME">onError</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onError</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>470</span> </span><span class="WHIT">            </span><span class="NAME">onBeforeLoad</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeLoad"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">target.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>471</span> </span><span class="WHIT">            </span><span class="NAME">$.ajax</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>472</span> </span><span class="WHIT">                </span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>473</span> </span><span class="WHIT">                </span><span class="NAME">method</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'POST'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>474</span> </span><span class="WHIT">                </span><span class="NAME">dataType</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'json'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>475</span> </span><span class="WHIT">                </span><span class="NAME">cache</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>476</span> </span><span class="WHIT">                </span><span class="NAME">success</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>477</span> </span><span class="WHIT">                	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.simpleDataModel</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>478</span> </span><span class="WHIT">                		</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._transformToNodes</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>479</span> </span><span class="WHIT">                	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>480</span> </span><span class="WHIT">                	</span><span class="NAME">target.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>481</span> </span><span class="WHIT">                    </span><span class="NAME">self._appendNodes.apply</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>482</span> </span><span class="WHIT">                    </span><span class="NAME">self.updateNode</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>483</span> </span><span class="WHIT">                    </span><span class="NAME">onSuccess</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onSuccess"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>484</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>485</span> </span><span class="WHIT">                </span><span class="NAME">error</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">XMLHttpRequest</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">textStatus</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">errorThrown</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>486</span> </span><span class="WHIT">                    </span><span class="NAME">onError</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onError"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">XMLHttpRequest</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">textStatus</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">errorThrown</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>487</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>488</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>489</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>490</span> </span><span class="WHIT">        </span><span class="COMM">/* -------------------- check and select node ------------------- */</span><span class="WHIT">
<span class='line'>491</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>492</span>          * 将指定节点前的勾选框设置为被勾选状态，该方法只有在属性showCheckbox为true时才生效。
<span class='line'>493</span>          * @name omTree#check
<span class='line'>494</span>          * @function
<span class='line'>495</span>          * @param target 指定节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>496</span>          * @example
<span class='line'>497</span>          * //将target节点的勾选状态设置为被勾选状态
<span class='line'>498</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>499</span>          * $('#myTree').omTree('check',target);
<span class='line'>500</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>501</span> </span><span class="WHIT">        </span><span class="NAME">check</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>502</span> </span><span class="WHIT">            </span><span class="NAME">this._toggleCheck</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>503</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>505</span>          * 将指定节点前的勾选框设置为未被勾选状态，该方法只有在属性showCheckbox为true时才生效。
<span class='line'>506</span>          * @name omTree#uncheck
<span class='line'>507</span>          * @function
<span class='line'>508</span>          * @param target 指定节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>509</span>          * @example
<span class='line'>510</span>          * //将target节点的勾选状态设置为不被勾选状态
<span class='line'>511</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>512</span>          * $('#myTree').omTree('uncheck',target);
<span class='line'>513</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">        </span><span class="NAME">uncheck</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">            </span><span class="NAME">this._toggleCheck</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">        </span><span class="COMM">// target equal le elem</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">        </span><span class="NAME">_toggleCheck</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">checkbox_item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.find</span><span class="PUNC">(</span><span class="STRN">">div.tree-checkbox"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>521</span> </span><span class="WHIT">            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>522</span> </span><span class="WHIT">            </span><span class="NAME">onCheck</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onCheck</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>523</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">                </span><span class="NAME">checkbox_item</span><span class="WHIT">
<span class='line'>525</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_part checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>526</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>527</span> </span><span class="WHIT">                </span><span class="NAME">checkbox_item</span><span class="WHIT">
<span class='line'>528</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_part"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>529</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>530</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>531</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">self.options.cascadeCheck</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>532</span> </span><span class="WHIT">                </span><span class="NAME">self._setChildCheckbox</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">checked</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">                </span><span class="NAME">self._setParentCheckbox</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>534</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>535</span> </span><span class="WHIT">            </span><span class="NAME">onCheck</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onCheck"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">target.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>536</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>538</span>          * 将所有节点的勾选框设置为被勾选状态，该方法只有在属性showCheckbox为true时才生效。
<span class='line'>539</span>          * @name omTree#checkAll
<span class='line'>540</span>          * @function
<span class='line'>541</span>          * @param checked 指定勾选框的勾选状态，checked为true为被勾选状态，为false为未被勾选状态
<span class='line'>542</span>          * @example
<span class='line'>543</span>          * //将所有节点的勾选框都设置为被勾选状态
<span class='line'>544</span>          * $('#myTree').omTree('checkAll',true);
<span class='line'>545</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>546</span> </span><span class="WHIT">        </span><span class="NAME">checkAll</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>547</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">                </span><span class="NAME">this.element</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">".tree-checkbox"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>550</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_part"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>553</span> </span><span class="WHIT">                </span><span class="NAME">this.element</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">".tree-checkbox"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">                    </span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_part checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>557</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>558</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>559</span>          * 判断指定节点的勾选状态，该方法只有在属性showCheckbox为true时才生效。
<span class='line'>560</span>          * @name omTree#isCheck
<span class='line'>561</span>          * @function
<span class='line'>562</span>          * @param target 指定节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>563</span>          * @returns true or false
<span class='line'>564</span>          * @example
<span class='line'>565</span>          * //判断target节点的勾选状态
<span class='line'>566</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>567</span>          * $('#myTree').omTree('isCheck',target);
<span class='line'>568</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>569</span> </span><span class="WHIT">        </span><span class="NAME">isCheck</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>570</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>571</span> </span><span class="WHIT">                       </span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">">div.tree-checkbox"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>572</span> </span><span class="WHIT">                       </span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">"checkbox_full"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>573</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>574</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>575</span>          * 获取所有被勾选或未被勾选节点的JSON数据对象集合。
<span class='line'>576</span>          * @name omTree#getChecked
<span class='line'>577</span>          * @function
<span class='line'>578</span>          * @param checked 指定勾选框的勾选状态，checked为true为被勾选状态，为false为未被勾选状态，默认为false
<span class='line'>579</span>          * @returns JSON数据对象集合
<span class='line'>580</span>          * @example
<span class='line'>581</span>          * //获取所有被勾选节点的JSON数据对象集合
<span class='line'>582</span>          * $('#myTree').omTree('getChecked',true);
<span class='line'>583</span>          */</span><span class="WHIT">      </span><span class="WHIT">
<span class='line'>584</span> </span><span class="WHIT">        </span><span class="NAME">getChecked</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">checked</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>585</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>586</span> </span><span class="WHIT">                </span><span class="NAME">nodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>587</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">filter_config</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">checked</span><span class="PUNC">?</span><span class="STRN">".checkbox_full"</span><span class="PUNC">:</span><span class="STRN">":not(.checkbox_full)"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>588</span> </span><span class="WHIT">            </span><span class="NAME">this.element</span><span class="WHIT">
<span class='line'>589</span> </span><span class="WHIT">                </span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">".tree-checkbox"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>590</span> </span><span class="WHIT">                </span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="NAME">filter_config</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>591</span> </span><span class="WHIT">                    </span><span class="NAME">nodes.push</span><span class="PUNC">(</span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>592</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>593</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>594</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>595</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>596</span>          * 将指定节点设置为选中状态。
<span class='line'>597</span>          * @name omTree#select
<span class='line'>598</span>          * @function
<span class='line'>599</span>          * @param target 指定节点的JSON数据，并且该节点数据中包括了nid属性。
<span class='line'>600</span>          * @example
<span class='line'>601</span>          * //将target节点设置为选中状态
<span class='line'>602</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>603</span>          * $('#myTree').omTree('select',target);
<span class='line'>604</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>605</span> </span><span class="WHIT">        </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>606</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>607</span> </span><span class="WHIT">                </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>608</span> </span><span class="WHIT">                </span><span class="NAME">onBeforeSelect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onBeforeSelect</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>609</span> </span><span class="WHIT">                </span><span class="NAME">onSelect</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.onSelect</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>610</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">onBeforeSelect</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeSelect"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>611</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>612</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>613</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>614</span> </span><span class="WHIT">            </span><span class="COMM">//var a = $(" >span >a", node);</span><span class="WHIT">
<span class='line'>615</span> </span><span class="WHIT">            </span><span class="COMM">//a.addClass("selected");</span><span class="WHIT">
<span class='line'>616</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">" >span"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>617</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldSelected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>618</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">curSelected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">node.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>619</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oldSelected</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">oldSelected</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">curSelected</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>620</span> </span><span class="WHIT">                </span><span class="COMM">//$("#" + oldSelected + " >span >a").removeClass("selected");</span><span class="WHIT">
<span class='line'>621</span> </span><span class="WHIT">                </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">oldSelected</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" >span"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>622</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>623</span> </span><span class="WHIT">            </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">curSelected</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>624</span> </span><span class="WHIT">            </span><span class="NAME">onSelect</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onSelect"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>625</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>626</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>627</span>          * 将指定节点设置为未选中状态。
<span class='line'>628</span>          * @name omTree#unselect
<span class='line'>629</span>          * @function
<span class='line'>630</span>          * @param target 指定节点的JSON数据，并且该节点数据中包括了nid属性
<span class='line'>631</span>          * @example
<span class='line'>632</span>          * //将target节点设置为未选中状态
<span class='line'>633</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>634</span>          * $('#myTree').omTree('unselect',target);
<span class='line'>635</span>          */</span><span class="WHIT">
<span class='line'>636</span> </span><span class="WHIT">        </span><span class="NAME">unselect</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>637</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>638</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>639</span> </span><span class="WHIT">            </span><span class="COMM">//var a = $(" >span >a", node);</span><span class="WHIT">
<span class='line'>640</span> </span><span class="WHIT">            </span><span class="COMM">//a.removeClass("selected");</span><span class="WHIT">
<span class='line'>641</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">" >span"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>642</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldSelected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>643</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">curSelected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">node.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>644</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">oldSelected</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">curSelected</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>645</span> </span><span class="WHIT">                </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>646</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>647</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>648</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>649</span>          * 获取被选中的节点的JSON数据对象。
<span class='line'>650</span>          * @name omTree#getSelected
<span class='line'>651</span>          * @function
<span class='line'>652</span>          * @returns JSON数据对象
<span class='line'>653</span>          * @example
<span class='line'>654</span>          * //获取被选中节点的JSON数据对象
<span class='line'>655</span>          * $('#myTree').omTree('getSelected');
<span class='line'>656</span>          */</span><span class="WHIT">
<span class='line'>657</span> </span><span class="WHIT">        </span><span class="NAME">getSelected</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>658</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">selected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>659</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">selected</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">selected</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>660</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>661</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>662</span> </span><span class="WHIT">        </span><span class="COMM">/* -------------------- find node ------------------- */</span><span class="WHIT">
<span class='line'>663</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>664</span>          * 根据节点数据的属性精确查找节点 pNode 下面的子节点中的 JSON 数据对象集合。
<span class='line'>665</span>          * @name omTree#findNodes
<span class='line'>666</span>          * @function
<span class='line'>667</span>          * @param key 进行查找的节点数据的属性名称
<span class='line'>668</span>          * @param value 属性值
<span class='line'>669</span>          * @param pNode 可选，指定的父节点，默认为查找所有节点
<span class='line'>670</span>          * @param deep 可选，是否递归查找子节点，默认为递归查找子节点
<span class='line'>671</span>          * @returns JSON数据对象集合
<span class='line'>672</span>          * @example
<span class='line'>673</span>          * //查找所有树节点中属性“classes”等于“folder”的节点
<span class='line'>674</span>          * $('#myTree').omTree('findNodes', "classes", 'folder', "",true);
<span class='line'>675</span>          */</span><span class="WHIT">
<span class='line'>676</span> </span><span class="WHIT">        </span><span class="NAME">findNodes</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>677</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>678</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>679</span> </span><span class="WHIT">            </span><span class="NAME">deep</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">deep</span><span class="PUNC">!=</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>680</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>681</span> </span><span class="WHIT">                </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>682</span> </span><span class="WHIT">                  </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._searchNode.apply</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._searchNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>683</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>684</span> </span><span class="WHIT">           </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>685</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>686</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>687</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>688</span>          * 根据节点数据的属性精确查找节点 pNode 的子节点中满足条件的 JSON 数据对象。
<span class='line'>689</span>          * 查找到第一个满足条件的节点则停止查找，返回该节点。
<span class='line'>690</span>          * @name omTree#findNode
<span class='line'>691</span>          * @function
<span class='line'>692</span>          * @param key 进行查找的节点数据的属性名称
<span class='line'>693</span>          * @param value 属性值
<span class='line'>694</span>          * @param pNode 可选，指定的父节点，默认为查找所有节点
<span class='line'>695</span>          * @param deep 可选，是否递归查找子节点，默认为递归查询子节点
<span class='line'>696</span>          * @returns JSON数据对象
<span class='line'>697</span>          * @example
<span class='line'>698</span>          * //查找所有树节点中第一个满足属性“classes”等于“folder”的节点
<span class='line'>699</span>          * $('#myTree').omTree('findNode', "classes", 'folder', "",true);
<span class='line'>700</span>          */</span><span class="WHIT">
<span class='line'>701</span> </span><span class="WHIT">        </span><span class="NAME">findNode</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>702</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>703</span> </span><span class="WHIT">            </span><span class="NAME">deep</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">deep</span><span class="PUNC">!=</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>704</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.length</span><span class="PUNC">)</span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>705</span> </span><span class="WHIT">                </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>706</span> </span><span class="WHIT">                  </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._searchNode.apply</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._searchNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>707</span> </span><span class="WHIT">                  </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>708</span> </span><span class="WHIT">                      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>709</span> </span><span class="WHIT">                  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>710</span> </span><span class="WHIT">               </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>711</span> </span><span class="WHIT">           </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>712</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>713</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>714</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>715</span>          * 根据nid精确查找节点。查找到第一个满足条件的节点则停止查找，返回该节点。
<span class='line'>716</span>          * @name omTree#findByNId
<span class='line'>717</span>          * @function
<span class='line'>718</span>          * @param nid 节点的唯一标识,该值是自动生成的，生成规则为treeId+ "_" + 计数
<span class='line'>719</span>          * @returns JSON数据对象
<span class='line'>720</span>          * @example
<span class='line'>721</span>          * //查找“nid”等于“treeId_4”的节点
<span class='line'>722</span>          * $('#myTree').omTree('findByNId','treeId_4');
<span class='line'>723</span>          */</span><span class="WHIT">
<span class='line'>724</span> </span><span class="WHIT">        </span><span class="NAME">findByNId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">nid</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>725</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">nid</span><span class="PUNC">]</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>726</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>727</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>728</span>          * 根据指定函数fn精确查找指定pNode的子节点中满足条件的JSON数据对象集合，函数fn中可以定义复杂的查询逻辑。
<span class='line'>729</span>          * @name omTree#findNodesBy
<span class='line'>730</span>          * @function
<span class='line'>731</span>          * @param fn 指定的查找函数，参数为节点的JSON数据对象，函数返回为true则改节点满足查找条件，反之false则不满足条件
<span class='line'>732</span>          * @param pNode 可选，指定的父节点，默认为查找所有节点
<span class='line'>733</span>          * @param deep 可选，是否递归查找子节点，默认为递归查找子节点
<span class='line'>734</span>          * @returns JSON数据对象集合
<span class='line'>735</span>          * @example
<span class='line'>736</span>          * //根据函数fn查找符合条件的所有节点的JSON数据对象集合
<span class='line'>737</span>          * $('#myTree').omTree('findNodesBy',fn);
<span class='line'>738</span>          */</span><span class="WHIT">
<span class='line'>739</span> </span><span class="WHIT">        </span><span class="NAME">findNodesBy</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>740</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>741</span> </span><span class="WHIT">            </span><span class="NAME">deep</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">deep</span><span class="PUNC">!=</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>742</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>743</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.length</span><span class="PUNC">)</span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>744</span> </span><span class="WHIT">             </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>745</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">fn.call</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>746</span> </span><span class="WHIT">                    </span><span class="NAME">result.push</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>747</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>748</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">deep</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>749</span> </span><span class="WHIT">                    </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.findNodesBy</span><span class="PUNC">(</span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>750</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>751</span> </span><span class="WHIT">                        </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.concat</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>752</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>753</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>754</span> </span><span class="WHIT">              </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>755</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>756</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>757</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>758</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>759</span>          * 根据指定函数fn精确查找指定pNode的子节点中满足条件的第一个节点的JSON数据对象，函数fn中可以定义复杂的查询逻辑。
<span class='line'>760</span>          * 查找到第一个满足条件的节点则停止查找，返回该节点的JSON数据对象。
<span class='line'>761</span>          * @name omTree#findNodeBy
<span class='line'>762</span>          * @function
<span class='line'>763</span>          * @param fn 指定的查找函数，拥有一个参数为节点的JSON数据对象，函数返回为true则该节点满足查找条件，反之false则不满足条件
<span class='line'>764</span>          * @param pNode 可选，指定的父节点，默认为查找所有节点
<span class='line'>765</span>          * @param deep 可选，是否递归查找子节点，默认为不递归查找子节点
<span class='line'>766</span>          * @returns JSON数据对象
<span class='line'>767</span>          * @example
<span class='line'>768</span>          * //根据函数fn查找符合条件的第一个子节点的JSON数据对象
<span class='line'>769</span>          * $('#myTree').omTree('findNodeBy',fn);
<span class='line'>770</span>          */</span><span class="WHIT">       </span><span class="WHIT">
<span class='line'>771</span> </span><span class="WHIT">        </span><span class="NAME">findNodeBy</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>772</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>773</span> </span><span class="WHIT">            </span><span class="NAME">deep</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">deep</span><span class="PUNC">!=</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>774</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.length</span><span class="PUNC">)</span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>775</span> </span><span class="WHIT">              </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>776</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">fn.call</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>777</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>778</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>779</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>780</span> </span><span class="WHIT">                    </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.findNodeBy</span><span class="PUNC">(</span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>781</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>782</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>783</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>784</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>785</span> </span><span class="WHIT">              </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>786</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>787</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>788</span> </span><span class="WHIT">         </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>789</span> </span><span class="WHIT">         </span><span class="WHIT">
<span class='line'>790</span> </span><span class="WHIT">        </span><span class="NAME">_searchNode</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_searchNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isSingle</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>791</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">isSingle</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>792</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>793</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>794</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.children</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.children.length</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>795</span> </span><span class="WHIT">                    </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">this.children</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>796</span> </span><span class="WHIT">                        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">temp</span><span class="PUNC">=</span><span class="NAME">_searchNode.apply</span><span class="PUNC">(</span><span class="NAME">this.children</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">,</span><span class="NAME">value</span><span class="PUNC">,</span><span class="NAME">_searchNode</span><span class="PUNC">,</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>797</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">temp</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">temp</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>798</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>799</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>800</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>801</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">      </span><span class="WHIT">
<span class='line'>802</span> </span><span class="WHIT">                    </span><span class="NAME">result.push</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>803</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>804</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.children</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this.children.length</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>805</span> </span><span class="WHIT">                    </span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">this.children</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_searchNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_searchNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">deep</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>806</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>807</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>808</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>809</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>810</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>811</span>          * 获取指定节点的父节点。
<span class='line'>812</span>          * @name omTree#getParent
<span class='line'>813</span>          * @function
<span class='line'>814</span>          * @param target 指定节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>815</span>          * @returns JSON数据对象
<span class='line'>816</span>          * @example
<span class='line'>817</span>          * //查找target的父节点的JSON数据对象
<span class='line'>818</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>819</span>          * $('#myTree').omTree('getParent',target);
<span class='line'>820</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>821</span> </span><span class="WHIT">        </span><span class="NAME">getParent</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>822</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>823</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">pid</span><span class="PUNC">?</span><span class="NAME">this.findByNId</span><span class="PUNC">(</span><span class="NAME">pid</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>824</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>825</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>826</span>          * 获取指定节点的所有子节点的JSON数据对象集合。
<span class='line'>827</span>          * @name omTree#getChildren
<span class='line'>828</span>          * @function
<span class='line'>829</span>          * @param target 指定节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>830</span>          * @returns JSON数据对象集合
<span class='line'>831</span>          * @example
<span class='line'>832</span>          * //查找target的父节点的JSON数据对象
<span class='line'>833</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>834</span>          * $('#myTree').omTree('getChildren',target);
<span class='line'>835</span>          */</span><span class="WHIT">      </span><span class="WHIT">
<span class='line'>836</span> </span><span class="WHIT">        </span><span class="NAME">getChildren</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>837</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">target.children</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>838</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>839</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>840</span>          * 获取树的dataSource对应的静态数据。
<span class='line'>841</span>          * @name omTree#getData
<span class='line'>842</span>          * @function
<span class='line'>843</span>          * @returns JSON数据对象集合
<span class='line'>844</span>          * @example
<span class='line'>845</span>          * //获取dataSource对应的静态数据
<span class='line'>846</span>          * $('#myTree').omTree('getData');
<span class='line'>847</span>          */</span><span class="WHIT">
<span class='line'>848</span> </span><span class="WHIT">        </span><span class="NAME">getData</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>849</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.options.dataSource</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>850</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>851</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>852</span>          * 设置树的dataSource所对应的静态数据。
<span class='line'>853</span>          * @name omTree#setData
<span class='line'>854</span>          * @function
<span class='line'>855</span>          * @example
<span class='line'>856</span>          * //设置dataSource对应的静态数据
<span class='line'>857</span>          * var data=[{text:'node2',children:[{text:'node21'},{text:'node22'}]},
<span class='line'>858</span>          *             {text:'node3'}
<span class='line'>859</span>          *      ];
<span class='line'>860</span>          * $('#myTree').omTree('setData',data);
<span class='line'>861</span>          * 
<span class='line'>862</span>          * //设置dataSource对应的动态数据
<span class='line'>863</span>          * $('#myTree').omTree('setData','../../omTree.json');
<span class='line'>864</span>          */</span><span class="WHIT">
<span class='line'>865</span> </span><span class="WHIT">        </span><span class="NAME">setData</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>866</span> </span><span class="WHIT">            </span><span class="NAME">this.options.dataSource</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>867</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>868</span> </span><span class="WHIT">        </span><span class="COMM">/* -------------------- expand and collapse node ------------------- */</span><span class="WHIT">
<span class='line'>869</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>870</span>          * 展开指定节点。
<span class='line'>871</span>          * @name omTree#expand
<span class='line'>872</span>          * @function
<span class='line'>873</span>          * @param target 指定节点的JSON数据对象
<span class='line'>874</span>          * @example
<span class='line'>875</span>          * //将target节点展开
<span class='line'>876</span>          * $('#myTree').omTree('expand',target);
<span class='line'>877</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>878</span> </span><span class="WHIT">        </span><span class="NAME">expand</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>879</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>880</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CLASSES.expandable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>881</span> </span><span class="WHIT">                    </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>882</span> </span><span class="WHIT">                </span><span class="WHIT">
<span class='line'>883</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">targetNodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">">div."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.hitarea</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">node</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>884</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>885</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parentsUntil</span><span class="PUNC">(</span><span class="NAME">this.element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">andSelf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>886</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="NAME">filter</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>887</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>888</span> </span><span class="WHIT">                </span><span class="NAME">this.toggler</span><span class="PUNC">(</span><span class="NAME">targetNodes</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>889</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>890</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>891</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>892</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>893</span>          * 收缩指定节点。
<span class='line'>894</span>          * @name omTree#collapse
<span class='line'>895</span>          * @function
<span class='line'>896</span>          * @param target 指定节点的JSON数据对象
<span class='line'>897</span>          * @example
<span class='line'>898</span>          * //将target节点收缩
<span class='line'>899</span>          * $('#myTree').omTree('collapse',target);
<span class='line'>900</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>901</span> </span><span class="WHIT">        </span><span class="NAME">collapse</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>902</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>903</span> </span><span class="WHIT">                </span><span class="NAME">this._collapseHandler</span><span class="PUNC">(</span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>904</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>905</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>906</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>907</span>          * 展开所有的树节点。
<span class='line'>908</span>          * @name omTree#expandAll
<span class='line'>909</span>          * @function
<span class='line'>910</span>          * @example
<span class='line'>911</span>          * //将所有的树节点展开
<span class='line'>912</span>          * $('#myTree').omTree('expandAll');
<span class='line'>913</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>914</span> </span><span class="WHIT">        </span><span class="NAME">expandAll</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>915</span> </span><span class="WHIT">            </span><span class="NAME">this._collapseHandler</span><span class="PUNC">(</span><span class="NAME">CLASSES.expandable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>916</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>917</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>918</span>          * 收缩所有的树节点。
<span class='line'>919</span>          * @name omTree#collapseAll
<span class='line'>920</span>          * @function
<span class='line'>921</span>          * @example
<span class='line'>922</span>          * //将所有的树节点收缩
<span class='line'>923</span>          * $('#myTree').omTree('collapseAll');
<span class='line'>924</span>          */</span><span class="WHIT">
<span class='line'>925</span> </span><span class="WHIT">        </span><span class="NAME">collapseAll</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>926</span> </span><span class="WHIT">            </span><span class="NAME">this._collapseHandler</span><span class="PUNC">(</span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>927</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>928</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>929</span> </span><span class="WHIT">        </span><span class="COMM">// filter: the class filter by the toggler</span><span class="WHIT">
<span class='line'>930</span> </span><span class="WHIT">        </span><span class="COMM">// elem: from witch element</span><span class="WHIT">
<span class='line'>931</span> </span><span class="WHIT">        </span><span class="NAME">_collapseHandler</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">filter</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">allPosterity</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>932</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">condition</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">allPosterity</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">">"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"div."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">  </span><span class="NAME">CLASSES.hitarea</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>933</span> </span><span class="WHIT">            </span><span class="NAME">this.toggler</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">condition</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>934</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>935</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>936</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>937</span> </span><span class="WHIT">        </span><span class="COMM">/* -------------------- edit node ------------------- */</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>938</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>939</span>          * 刷新指定树节点及其子节点。
<span class='line'>940</span>          * @name omTree#refresh
<span class='line'>941</span>          * @param target 可选，指定节点的JSON数据对象。不传参数则刷新整棵树。
<span class='line'>942</span>          * @function
<span class='line'>943</span>          * @example
<span class='line'>944</span>          * //刷新整棵树
<span class='line'>945</span>          * $('#myTree').omTree('refresh');
<span class='line'>946</span>          */</span><span class="WHIT">
<span class='line'>947</span> </span><span class="WHIT">        </span><span class="NAME">refresh</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>948</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tree</span><span class="PUNC">=</span><span class="NAME">self.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>949</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.getData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>950</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>951</span> </span><span class="WHIT">            		</span><span class="NAME">tree.empty</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>952</span> </span><span class="WHIT">            		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>953</span> </span><span class="WHIT">                        </span><span class="NAME">self._ajaxLoad</span><span class="PUNC">(</span><span class="NAME">tree</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>954</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>955</span> </span><span class="WHIT">                       </span><span class="NAME">self.setData</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>956</span> </span><span class="WHIT">            		   </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>957</span> </span><span class="WHIT">            			  </span><span class="NAME">self.insert</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>958</span> </span><span class="WHIT">            		   </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>959</span> </span><span class="WHIT">            	  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>960</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>961</span> </span><span class="WHIT">            		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nextNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>962</span> </span><span class="WHIT">            		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tree.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>963</span> </span><span class="WHIT">            		</span><span class="NAME">self.remove</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>964</span> </span><span class="WHIT">            		</span><span class="NAME">self.insert</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">pid</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">nextNode.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>965</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>966</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>967</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>968</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>969</span> </span><span class="WHIT">        </span><span class="COMM">// 简单数据模型转化为树状结构的数据</span><span class="WHIT">
<span class='line'>970</span> </span><span class="WHIT">        </span><span class="NAME">_transformToNodes</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>971</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>972</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>973</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>974</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tmpMap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>975</span> </span><span class="WHIT">			</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">=</span><span class="NAME">data.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>976</span> </span><span class="WHIT">				</span><span class="NAME">tmpMap</span><span class="PUNC">[</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="STRN">"id"</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>977</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>978</span> </span><span class="WHIT">			</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">=</span><span class="NAME">data.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>979</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">tmpMap</span><span class="PUNC">[</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>980</span> </span><span class="WHIT">					</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>981</span> </span><span class="WHIT">					</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">tmpMap</span><span class="PUNC">[</span><span class="NAME">pid</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="STRN">"children"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>982</span> </span><span class="WHIT">						</span><span class="NAME">tmpMap</span><span class="PUNC">[</span><span class="NAME">pid</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="STRN">"children"</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>983</span> </span><span class="WHIT">					</span><span class="COMM">//delete data[i]["pid"];</span><span class="WHIT">
<span class='line'>984</span> </span><span class="WHIT">					</span><span class="NAME">tmpMap</span><span class="PUNC">[</span><span class="NAME">pid</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="STRN">"children"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>985</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>986</span> </span><span class="WHIT">					</span><span class="NAME">r.push</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>987</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>988</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>989</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>990</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>991</span> </span><span class="WHIT">        </span><span class="NAME">_appendNodes</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isDrop</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>992</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ht</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>993</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">checkable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options.showCheckbox</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>994</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">treeid</span><span class="PUNC">=</span><span class="NAME">self.element.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">self.element.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="PUNC">(</span><span class="STRN">"treeId"</span><span class="PUNC">+</span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">Math.random</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">*</span><span class="NUMB">1000</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>995</span> </span><span class="WHIT">            </span><span class="NAME">self.element.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">,</span><span class="NAME">treeid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>996</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodes.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>997</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">node</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isLastNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nodes.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>998</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nodeClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"om-tree-node "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">checkable</span><span class="PUNC">?</span><span class="STRN">"treenode-checkable "</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">node.hasChildren</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"hasChildren "</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>999</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nid</span><span class="PUNC">=</span><span class="NAME">treeid</span><span class="PUNC">+</span><span class="STRN">"_"</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="PUNC">++</span><span class="NAME">self.options.nodeCount</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1000</span> </span><span class="WHIT">                </span><span class="NAME">node.nid</span><span class="PUNC">=</span><span class="NAME">nid</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1001</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">caches</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1002</span> </span><span class="WHIT">                </span><span class="NAME">caches</span><span class="PUNC">[</span><span class="NAME">node.nid</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">node</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1003</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1004</span> </span><span class="WHIT">                    </span><span class="NAME">caches</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="PUNC">+</span><span class="NAME">node.nid</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1005</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">isLastNode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1006</span> </span><span class="WHIT">                        </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1007</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1008</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1009</span> </span><span class="WHIT">                    </span><span class="NAME">caches</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="PUNC">+</span><span class="NAME">node.nid</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.parent</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1010</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1011</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">childHtml</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1012</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">node.children</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">node.children.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1013</span> </span><span class="WHIT">                    </span><span class="NAME">childHtml.push</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">self._appendNodes</span><span class="PUNC">(</span><span class="NAME">node.nid</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">node.children</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1014</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1015</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1016</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">node.children</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="PUNC">=</span><span class="NAME">node.children.length</span><span class="PUNC">)</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">||</span><span class="NAME">node.hasChildren</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1017</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">node.expanded</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1018</span> </span><span class="WHIT">                        </span><span class="NAME">nodeClass</span><span class="PUNC">=</span><span class="NAME">nodeClass</span><span class="PUNC">+</span><span class="STRN">"open "</span><span class="PUNC">+</span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">isLastNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1019</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1020</span> </span><span class="WHIT">                        </span><span class="NAME">nodeClass</span><span class="PUNC">=</span><span class="NAME">nodeClass</span><span class="PUNC">+</span><span class="NAME">CLASSES.expandable</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">isLastNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1021</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1022</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1023</span> </span><span class="WHIT">                    </span><span class="NAME">nodeClass</span><span class="PUNC">=</span><span class="NAME">nodeClass</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">isLastNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">CLASSES.last</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1024</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1025</span> </span><span class="WHIT">                </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;li id='"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">node.nid</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"' class='"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="NAME">nodeClass</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="STRN">"'>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1026</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">node.hasChildren</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1027</span> </span><span class="WHIT">                	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">classes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1028</span> </span><span class="WHIT">                    </span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">nodeClass.split</span><span class="PUNC">(</span><span class="STRN">" "</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1029</span> </span><span class="WHIT">                        </span><span class="NAME">classes</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"-hitarea "</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1030</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1031</span> </span><span class="WHIT">                	</span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;div class='"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.hitarea</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="NAME">classes</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"'/>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1032</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1033</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">checkable</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1034</span> </span><span class="WHIT">                    </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;div class='tree-checkbox'/>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1035</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1036</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">spanClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">node.classes</span><span class="PUNC">?</span><span class="NAME">node.classes</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1037</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">self.options.showIcon</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1038</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">node.hasChildren</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">node.children</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">node.children.length</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1039</span> </span><span class="WHIT">                        </span><span class="NAME">spanClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spanClass</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" folder "</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1040</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1041</span> </span><span class="WHIT">                        </span><span class="NAME">spanClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spanClass</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" file "</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1042</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>1043</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1044</span> </span><span class="WHIT">                </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;span class='"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spanClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"'>"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&lt;a href='#'>"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">node.text</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"&lt;/a>&lt;/span>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1045</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">node.hasChildren</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1046</span> </span><span class="WHIT">                    </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;ul"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">" style='display:"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">node.expanded</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"block"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"none"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="STRN">"'>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1047</span> </span><span class="WHIT">                    </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="NAME">childHtml.join</span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1048</span> </span><span class="WHIT">                    </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/ul>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1049</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1050</span> </span><span class="WHIT">                </span><span class="NAME">ht.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/li>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1051</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1052</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">bNode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1053</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">isDrop</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1054</span> </span><span class="WHIT">                    </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">bNode.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">after</span><span class="PUNC">(</span><span class="NAME">ht.join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1055</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1056</span> </span><span class="WHIT">                    </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">bNode.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">before</span><span class="PUNC">(</span><span class="NAME">ht.join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1057</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1058</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1059</span> </span><span class="WHIT">                </span><span class="NAME">target.append</span><span class="PUNC">(</span><span class="NAME">ht.join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1060</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1061</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">ht</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1062</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1063</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1064</span>          * 删除指定pNode的子节点中对应的JSON数据对象为target的节点。
<span class='line'>1065</span>          * @name omTree#remove
<span class='line'>1066</span>          * @function
<span class='line'>1067</span>          * @param target 需要被删除的节点对应的JSON数据，并且该节点数据中包括了nid属性
<span class='line'>1068</span>          * @param pNode 可选，指定的父节点对应的JSON数据对象，不传入，则为树的根节点
<span class='line'>1069</span>          * @example
<span class='line'>1070</span>          * //删除树种对应JSON数据对象为target的节点
<span class='line'>1071</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>1072</span>          * $('#myTree').omTree('remove',target);
<span class='line'>1073</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>1074</span> </span><span class="WHIT">        </span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1075</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">flag</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">=</span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1076</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1077</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1078</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ids</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1079</span> </span><span class="WHIT">                    </span><span class="NAME">ids</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._findChildrenId</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ids</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1080</span> </span><span class="WHIT">                    </span><span class="NAME">ids.push</span><span class="PUNC">(</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1081</span> </span><span class="WHIT">                    </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ids.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1082</span> </span><span class="WHIT">                        </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">ids</span><span class="PUNC">[</span><span class="NAME">n</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1083</span> </span><span class="WHIT">                        </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="PUNC">+</span><span class="NAME">ids</span><span class="PUNC">[</span><span class="NAME">n</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1084</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1085</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target.nid</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1086</span> </span><span class="WHIT">                        </span><span class="NAME">this.element.data</span><span class="PUNC">(</span><span class="STRN">"selected"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1087</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1088</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pre</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">prev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1089</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">&lt;</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">pre.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1090</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">pre.hasClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1091</span> </span><span class="WHIT">                            </span><span class="NAME">pre.addClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1092</span> </span><span class="WHIT">                            </span><span class="NAME">pre.find</span><span class="PUNC">(</span><span class="STRN">"div.hitarea"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">first</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.lastCollapsableHitarea</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1093</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">pre.hasClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.expandable</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1094</span> </span><span class="WHIT">                            </span><span class="NAME">pre.addClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1095</span> </span><span class="WHIT">                            </span><span class="NAME">pre.find</span><span class="PUNC">(</span><span class="STRN">"div.hitarea"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">first</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.lastExpandableHitarea</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1096</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1097</span> </span><span class="WHIT">                            </span><span class="NAME">pre.addClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.last</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1098</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1099</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1100</span> </span><span class="WHIT">                    </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1101</span> </span><span class="WHIT">                    </span><span class="NAME">data.splice</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1102</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">pNode</span><span class="PUNC">&&</span><span class="NAME">pNode.nid</span><span class="PUNC">&&</span><span class="NAME">data.length</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1103</span> </span><span class="WHIT">                    	</span><span class="NAME">self._changeToFolderOrFile</span><span class="PUNC">(</span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1104</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1105</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1106</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1107</span> </span><span class="WHIT">                    </span><span class="NAME">flag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.remove</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1108</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">flag</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1109</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1110</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1111</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1112</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1113</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1114</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1115</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>1116</span> </span><span class="WHIT">        </span><span class="NAME">_findChildrenId</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ids</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1117</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target.children</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1118</span> </span><span class="WHIT">                </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">children</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.children</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">children.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1119</span> </span><span class="WHIT">                    </span><span class="NAME">ids.push</span><span class="PUNC">(</span><span class="NAME">children</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">nid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1120</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">children</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1121</span> </span><span class="WHIT">                        </span><span class="NAME">this._findChildrenId</span><span class="PUNC">(</span><span class="NAME">children</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ids</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1122</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1123</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1124</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1125</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">ids</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1126</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1127</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1128</span>          * 在指定pNode的子节点中插入一个JSON数据对象为target的节点，并且被插入的节点在指定bNode节点前。
<span class='line'>1129</span>          * @name omTree#insert
<span class='line'>1130</span>          * @function
<span class='line'>1131</span>          * @param target 需要被插入的节点对应的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>1132</span>          * @param pNode 可选，指定的父节点对应的JSON数据对象，，并且该节点数据中包括了nid属性，不传入，则为树的根节点
<span class='line'>1133</span>          * @param bNode 可选，指定被插入节点位置，，并且该节点数据中包括了nid属性，不传入，则在pNode子节点的最后插入节点
<span class='line'>1134</span>          * @example
<span class='line'>1135</span>          * //在pNode的子节点后插入对应JSON数据对象为target的节点
<span class='line'>1136</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>1137</span>          * $('#myTree').omTree('insert',target，pNode);
<span class='line'>1138</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>1139</span> 
<span class='line'>1140</span> </span><span class="WHIT">        </span><span class="NAME">insert</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isDrop</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1141</span> </span><span class="WHIT">        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1142</span> </span><span class="WHIT">        		</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1143</span> </span><span class="WHIT">        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1144</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">parent</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">otherChildren</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">flag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.isArray</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1145</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">flag</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1146</span> </span><span class="WHIT">            	</span><span class="NAME">nodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1147</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1148</span> </span><span class="WHIT">            	</span><span class="NAME">nodes.push</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1149</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1150</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">bNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>1151</span> </span><span class="WHIT">                </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">bNode.nid</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1152</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1153</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"init_dataSource"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1154</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">pNode.children</span><span class="PUNC">||</span><span class="NAME">pNode.children.length</span><span class="PUNC">&lt;</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1155</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">pNode.hasChildren</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">           		</span><span class="WHIT">
<span class='line'>1156</span> </span><span class="WHIT">            		</span><span class="NAME">self._changeToFolderOrFile</span><span class="PUNC">(</span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1157</span> </span><span class="WHIT">            		</span><span class="NAME">self._bindHitEvent</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">pNode.nid</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1158</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1159</span> </span><span class="WHIT">                </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode.children</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1160</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1161</span> </span><span class="WHIT">            </span><span class="NAME">parent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">pNode.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">first</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1162</span> </span><span class="WHIT">            </span><span class="NAME">otherChildren</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parent.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1163</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">bNode</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.inArray</span><span class="PUNC">(</span><span class="NAME">bNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1164</span> </span><span class="WHIT">                </span><span class="NAME">self._appendNodes</span><span class="PUNC">(</span><span class="NAME">parent</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isDrop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1165</span> </span><span class="WHIT">                </span><span class="NAME">data.splice</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1166</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1167</span> </span><span class="WHIT">                </span><span class="NAME">self._appendNodes</span><span class="PUNC">(</span><span class="NAME">parent</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nodes</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isDrop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1168</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">flag</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1169</span> </span><span class="WHIT">                    </span><span class="NAME">$.merge</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">             </span><span class="WHIT">
<span class='line'>1170</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1171</span> </span><span class="WHIT">                	</span><span class="NAME">data.push</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1172</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1173</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1174</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">m</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parent.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1175</span> </span><span class="WHIT">                        </span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.last</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">",."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">+</span><span class="STRN">",."</span><span class="PUNC">+</span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1176</span> </span><span class="WHIT">                        </span><span class="PUNC">.</span><span class="NAME">not</span><span class="PUNC">(</span><span class="NAME">parent.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1177</span> </span><span class="WHIT">                        </span><span class="PUNC">.</span><span class="NAME">filter</span><span class="PUNC">(</span><span class="STRN">":last-child:not(ul)"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1178</span> </span><span class="WHIT">            </span><span class="NAME">m.removeClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.last</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastCollapsable</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1179</span> </span><span class="WHIT">            </span><span class="NAME">m.find</span><span class="PUNC">(</span><span class="STRN">" >div"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.lastCollapsableHitarea</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="NAME">CLASSES.lastExpandableHitarea</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1180</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tdom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parent.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">not</span><span class="PUNC">(</span><span class="NAME">otherChildren</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">                        </span><span class="WHIT">
<span class='line'>1181</span> </span><span class="WHIT">            </span><span class="NAME">self._applyEvents</span><span class="PUNC">(</span><span class="NAME">tdom</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1182</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1183</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>1184</span> </span><span class="WHIT">        </span><span class="NAME">_changeToFolderOrFile</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">node</span><span class="PUNC">,</span><span class="NAME">isToFolder</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1185</span> </span><span class="WHIT">        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nDom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">node.nid</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">self</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1186</span> </span><span class="WHIT">        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">isToFolder</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1187</span> </span><span class="WHIT">        		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"&lt;ul/>"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">,</span><span class="WHIT">  </span><span class="STRN">"block"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">appendTo</span><span class="PUNC">(</span><span class="NAME">nDom</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1188</span> </span><span class="WHIT">        		</span><span class="NAME">nDom.addClass</span><span class="PUNC">(</span><span class="STRN">"open "</span><span class="PUNC">+</span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1189</span> </span><span class="WHIT">        		</span><span class="NAME">self._swapClass</span><span class="PUNC">(</span><span class="NAME">nDom</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.last</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1190</span> </span><span class="WHIT">        		</span><span class="NAME">node.children</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1191</span> </span><span class="WHIT">        	</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1192</span> </span><span class="WHIT">        		</span><span class="NAME">nDom.find</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1193</span> </span><span class="WHIT">        		</span><span class="NAME">nDom.find</span><span class="PUNC">(</span><span class="STRN">"div."</span><span class="PUNC">+</span><span class="NAME">CLASSES.hitarea</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1194</span> </span><span class="WHIT">        		</span><span class="NAME">nDom.filter</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="PUNC">+</span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">+</span><span class="STRN">",."</span><span class="PUNC">+</span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1195</span> </span><span class="WHIT">        		</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.lastCollapsable</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="NAME">CLASSES.lastExpandable</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">CLASSES.last</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1196</span> </span><span class="WHIT">        		</span><span class="NAME">nDom.removeClass</span><span class="PUNC">(</span><span class="STRN">"open "</span><span class="PUNC">+</span><span class="NAME">CLASSES.collapsable</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="NAME">CLASSES.expandable</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1197</span> </span><span class="WHIT">        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1198</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">self.options.showIcon</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1199</span> </span><span class="WHIT">                </span><span class="NAME">self._swapClass</span><span class="PUNC">(</span><span class="NAME">nDom.children</span><span class="PUNC">(</span><span class="STRN">"span"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="STRN">"file"</span><span class="PUNC">,</span><span class="STRN">"folder"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1200</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1201</span> </span><span class="WHIT">        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hitarea</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nDom.filter</span><span class="PUNC">(</span><span class="STRN">":has(>ul)"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">prepend</span><span class="PUNC">(</span><span class="STRN">"&lt;div class=\""</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.hitarea</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"\"/>"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"div."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">CLASSES.hitarea</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1202</span> </span><span class="WHIT">            </span><span class="NAME">hitarea.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1203</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">classes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1204</span> </span><span class="WHIT">                </span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"class"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">" "</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1205</span> </span><span class="WHIT">                    </span><span class="NAME">classes</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"-hitarea "</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1206</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1207</span> </span><span class="WHIT">                </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">classes</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1208</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1209</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1210</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>1211</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>1212</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1213</span>          * 在指定pNode的子节点中将JSON数据对象为target的节点修改其JSON数据对象为newNode。
<span class='line'>1214</span>          * @name omTree#modify
<span class='line'>1215</span>          * @function
<span class='line'>1216</span>          * @param target 需要修改的节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>1217</span>          * @param newNode 修改后节点的JSON数据对象，并且该节点数据中包括了nid属性
<span class='line'>1218</span>          * @param pNode 可选，指定的父节点对应的JSON数据对象，，并且该节点数据中包括了nid属性，不传入，则为树的根节点
<span class='line'>1219</span>          * @example
<span class='line'>1220</span>          * //将JSON数据对象为target的节点修改其JSON数据对象为newNode
<span class='line'>1221</span>          * var target = $('#myTree').omTree("findNode", "text", "node1");
<span class='line'>1222</span>          * var newNode ={text: "node5"};
<span class='line'>1223</span>          * $('#myTree').omTree('insert',target，newNode);
<span class='line'>1224</span>          */</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>1225</span> </span><span class="WHIT">        </span><span class="NAME">modify</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">newNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1226</span> </span><span class="WHIT">        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">&&</span><span class="NAME">newNode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1227</span> </span><span class="WHIT">        		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nextNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bNode</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1228</span> </span><span class="WHIT">                </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.findByNId</span><span class="PUNC">(</span><span class="NAME">self.element.data</span><span class="PUNC">(</span><span class="STRN">"nodes"</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="STRN">"pid"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">target.nid</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1229</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nextNode.is</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">nextNode.is</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1230</span> </span><span class="WHIT">                    </span><span class="NAME">bNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.findByNId</span><span class="PUNC">(</span><span class="NAME">nextNode.attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1231</span> </span><span class="WHIT">                </span><span class="NAME">self.remove</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1232</span> </span><span class="WHIT">                </span><span class="NAME">self.insert</span><span class="PUNC">(</span><span class="NAME">newNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pNode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">bNode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>1233</span> </span><span class="WHIT">        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1234</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1235</span> </span><span class="WHIT">        </span><span class="COMM">/* -------------------- disable and enable node ------------------- */</span><span class="WHIT">
<span class='line'>1236</span> </span><span class="WHIT">        </span><span class="NAME">disable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1237</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>1238</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1239</span> </span><span class="WHIT">        </span><span class="NAME">enable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1240</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>1241</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1242</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>1243</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1244</span>          * 远程更新数据异常后执行的方法 .错误信息为jQuery.ajax返回的异常信息，可参考jQuery.ajax官方文档。
<span class='line'>1245</span>          * @event
<span class='line'>1246</span>          * @name omTree#onError
<span class='line'>1247</span>          * @param xmlHttpRequest XMLHttpRequest 对象
<span class='line'>1248</span>          * @param textStatus 错误信息
<span class='line'>1249</span>          * @param errorThrown （可选）捕获的异常对象
<span class='line'>1250</span>          * @param event jQuery.Event对象
<span class='line'>1251</span>          * @example
<span class='line'>1252</span>          *  $(".selector").omTree({
<span class='line'>1253</span>          *      onError:function(xmlHttpRequest,textStatus,errorThrown,event){
<span class='line'>1254</span>          *          alert('error occured');
<span class='line'>1255</span>          *      }
<span class='line'>1256</span>          *  });
<span class='line'>1257</span>          */</span><span class="WHIT">
<span class='line'>1258</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1259</span>          * 单击树节点触发事件。
<span class='line'>1260</span>          * @event
<span class='line'>1261</span>          * @name omTree#onClick
<span class='line'>1262</span>          * @param nodeData 树节点的json对象
<span class='line'>1263</span>          * @param event jQuery.Event对象
<span class='line'>1264</span>          * @example
<span class='line'>1265</span>          *  $("#tree").omTree({
<span class='line'>1266</span>          *      onClick: function(nodeData, event){ ... }
<span class='line'>1267</span>          *  });
<span class='line'>1268</span>          */</span><span class="WHIT">
<span class='line'>1269</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1270</span>          * 双击树节点触发事件。
<span class='line'>1271</span>          * @event
<span class='line'>1272</span>          * @name omTree#onDblClick
<span class='line'>1273</span>          * @param nodeData 树节点的json对象
<span class='line'>1274</span>          * @param event jQuery.Event对象
<span class='line'>1275</span>          * @example
<span class='line'>1276</span>          *  $("#tree").omTree({
<span class='line'>1277</span>          *      onDblClick: function(nodeData, event){ ... }
<span class='line'>1278</span>          *  });
<span class='line'>1279</span>          */</span><span class="WHIT">
<span class='line'>1280</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1281</span>          * 右键树节点触发事件。
<span class='line'>1282</span>          * @event
<span class='line'>1283</span>          * @name omTree#onRightClick
<span class='line'>1284</span>          * @param nodeData 树节点的json对象
<span class='line'>1285</span>          * @param event jQuery.Event对象
<span class='line'>1286</span>          * @example
<span class='line'>1287</span>          *  $("#tree").omTree({
<span class='line'>1288</span>          *      onRightClick: function(nodeData, event){ ... }
<span class='line'>1289</span>          *  });
<span class='line'>1290</span>          */</span><span class="WHIT">
<span class='line'>1291</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1292</span>          * 树节点远程装载前触发事件。
<span class='line'>1293</span>          * @event
<span class='line'>1294</span>          * @name omTree#onBeforeLoad
<span class='line'>1295</span>          * @param nodeData 树节点的json对象
<span class='line'>1296</span>          * @example
<span class='line'>1297</span>          *  $("#tree").omTree({
<span class='line'>1298</span>          *      onBeforeLoad: function(nodeData){ ... }
<span class='line'>1299</span>          *  });
<span class='line'>1300</span>          */</span><span class="WHIT">
<span class='line'>1301</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1302</span>          * 树节点远程装载成功后触发事件。
<span class='line'>1303</span>          * @event
<span class='line'>1304</span>          * @name omTree#onSuccess
<span class='line'>1305</span>          * @param data 装载成功后获取的数据json
<span class='line'>1306</span>          * @example
<span class='line'>1307</span>          *  $("#tree").omTree({
<span class='line'>1308</span>          *      onSuccess: function(data){ ... }
<span class='line'>1309</span>          *  });
<span class='line'>1310</span>          */</span><span class="WHIT">
<span class='line'>1311</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1312</span>          * 树节点拖动时触发事件。该事件在拖动开始时触发，整个过程只触发一次。
<span class='line'>1313</span>          * @event
<span class='line'>1314</span>          * @name omTree#onDrag
<span class='line'>1315</span>          * @param nodeData 被拖动的树节点json对象
<span class='line'>1316</span>          * @param event jQuery.Event对象
<span class='line'>1317</span>          * @example
<span class='line'>1318</span>          *  $("#tree").omTree({
<span class='line'>1319</span>          *      onDrag: function(nodeData, event){ ... }
<span class='line'>1320</span>          *  });
<span class='line'>1321</span>          */</span><span class="WHIT">
<span class='line'>1322</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1323</span>          * 树节点拖动放置时触发事件。
<span class='line'>1324</span>          * @event
<span class='line'>1325</span>          * @name omTree#onDrop
<span class='line'>1326</span>          * @param nodeData 被拖动的树节点json对象
<span class='line'>1327</span>          * @param event jQuery.Event对象
<span class='line'>1328</span>          * @example
<span class='line'>1329</span>          *  $("#tree").omTree({
<span class='line'>1330</span>          *      onDrop: function(nodeData, event){ ... }
<span class='line'>1331</span>          *  });
<span class='line'>1332</span>          */</span><span class="WHIT">
<span class='line'>1333</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1334</span>          * 树节点展开前触发事件。
<span class='line'>1335</span>          * @event
<span class='line'>1336</span>          * @name omTree#onBeforeExpand
<span class='line'>1337</span>          * @param nodeData 树节点的json对象
<span class='line'>1338</span>          * @example
<span class='line'>1339</span>          *  $("#tree").omTree({
<span class='line'>1340</span>          *      onBeforeExpand: function(nodeData){ ... }
<span class='line'>1341</span>          *  });
<span class='line'>1342</span>          */</span><span class="WHIT">
<span class='line'>1343</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1344</span>          * 树节点收缩前触发事件。
<span class='line'>1345</span>          * @event
<span class='line'>1346</span>          * @name omTree#onBeforeCollapse
<span class='line'>1347</span>          * @param nodeData 树节点的json对象
<span class='line'>1348</span>          * @example
<span class='line'>1349</span>          *  $("#tree").omTree({
<span class='line'>1350</span>          *      onBeforeCollapse: function(nodeData){ ... }
<span class='line'>1351</span>          *  });
<span class='line'>1352</span>          */</span><span class="WHIT">
<span class='line'>1353</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1354</span>          * 树节点展开后触发事件。
<span class='line'>1355</span>          * @event
<span class='line'>1356</span>          * @name omTree#onExpand
<span class='line'>1357</span>          * @param nodeData 树节点的json对象
<span class='line'>1358</span>          * @example
<span class='line'>1359</span>          *  $("#tree").omTree({
<span class='line'>1360</span>          *      onExpand: function(nodeData){ ... }
<span class='line'>1361</span>          *  });
<span class='line'>1362</span>          */</span><span class="WHIT">
<span class='line'>1363</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1364</span>          * 树节点收缩后触发事件。
<span class='line'>1365</span>          * @event
<span class='line'>1366</span>          * @name omTree#onCollapse
<span class='line'>1367</span>          * @param nodeData 树节点的json对象
<span class='line'>1368</span>          * @example
<span class='line'>1369</span>          *  $("#tree").omTree({
<span class='line'>1370</span>          *      onCollapse: function(nodeData){ ... }
<span class='line'>1371</span>          *  });
<span class='line'>1372</span>          */</span><span class="WHIT">
<span class='line'>1373</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1374</span>          * 树节点选中后触发事件。
<span class='line'>1375</span>          * @event
<span class='line'>1376</span>          * @name omTree#onCheck
<span class='line'>1377</span>          * @param nodeData 树节点的json对象
<span class='line'>1378</span>          * @example
<span class='line'>1379</span>          *  $("#tree").omTree({
<span class='line'>1380</span>          *      onCheck: function(nodeData){ ... }
<span class='line'>1381</span>          *  });
<span class='line'>1382</span>          */</span><span class="WHIT">
<span class='line'>1383</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1384</span>          * 树节点选择后触发事件。
<span class='line'>1385</span>          * @event
<span class='line'>1386</span>          * @name omTree#onSelect
<span class='line'>1387</span>          * @param nodeData 树节点的json对象
<span class='line'>1388</span>          * @example
<span class='line'>1389</span>          *  $("#tree").omTree({
<span class='line'>1390</span>          *      onSelect: function(nodeData){ ... }
<span class='line'>1391</span>          *  });
<span class='line'>1392</span>          */</span><span class="WHIT">
<span class='line'>1393</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>1394</span>          * 树节点选择前触发事件。
<span class='line'>1395</span>          * @event
<span class='line'>1396</span>          * @name omTree#onBeforeSelect
<span class='line'>1397</span>          * @param nodeData 树节点的json对象
<span class='line'>1398</span>          * @example
<span class='line'>1399</span>          *  $("#tree").omTree({
<span class='line'>1400</span>          *      onBeforeSelect: function(nodeData){ ... }
<span class='line'>1401</span>          *  });
<span class='line'>1402</span>          */</span><span class="WHIT">
<span class='line'>1403</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1404</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="NAME">jQuery</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>